package com.yt;

import java.util.concurrent.CountDownLatch;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import lombok.extern.slf4j.Slf4j;

/**
 * dubbo服务启动类
 * 
 * @author 431910788@qq.com
 * 
 */
@Slf4j
public class Bootstrap {
	public static void main(String[] args) throws Exception {
		final ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext(
				"spring/dubbo-provider.xml", "spring/dubbo-consumer.xml");
		ac.start();
		log.info("yt-service started successfully");
		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				log.debug("Shutdown hook was invoked. Shutting down Shop Service.");
				ac.close();
			}
		});
		// prevent main thread from exit
		CountDownLatch countDownLatch = new CountDownLatch(1);
		countDownLatch.await();
	}
}
